AppOpsManagerCompat

Helper for accessing features in android.app.AppOpsManager.

Properties

Link copied to clipboard
val MODE_ALLOWED: Int = 0
Result from noteOp: the given caller is allowed to perform the given operation.
Link copied to clipboard
val MODE_DEFAULT: Int = 3
Result from noteOp: the given caller should use its default security check.
Link copied to clipboard
val MODE_ERRORED: Int = 2
Result from noteOpNoThrow: the given caller is not allowed to perform the given operation, and this attempt should cause it to have a fatal error, typically a SecurityException.
Link copied to clipboard
val MODE_IGNORED: Int = 1
Result from noteOp: the given caller is not allowed to perform the given operation, and this attempt should silently fail (it should not cause the app to crash).

Functions

Link copied to clipboard
open fun checkOrNoteProxyOp(@NonNull context: @NonNull Context, proxyUid: Int, @NonNull op: @NonNull String, @NonNull proxiedPackageName: @NonNull String): Int
Check op for both proxy and proxied packages.
Link copied to clipboard
open fun noteOp(@NonNull context: @NonNull Context, @NonNull op: @NonNull String, uid: Int, @NonNull packageName: @NonNull String): Int
Make note of an application performing an operation.
Link copied to clipboard
open fun noteOpNoThrow(@NonNull context: @NonNull Context, @NonNull op: @NonNull String, uid: Int, @NonNull packageName: @NonNull String): Int
Like noteOp but instead of throwing a SecurityException it returns MODE_ERRORED.
Link copied to clipboard
open fun noteProxyOp(@NonNull context: @NonNull Context, @NonNull op: @NonNull String, @NonNull proxiedPackageName: @NonNull String): Int
Make note of an application performing an operation on behalf of another application when handling an IPC.
Link copied to clipboard
open fun noteProxyOpNoThrow(@NonNull context: @NonNull Context, @NonNull op: @NonNull String, @NonNull proxiedPackageName: @NonNull String): Int
Like noteProxyOp but instead of throwing a SecurityException it returns MODE_ERRORED.
Link copied to clipboard
@Nullable
open fun permissionToOp(@NonNull permission: @NonNull String): @Nullable String
Gets the app op name associated with a given permission.